9377:DRMCRT_memmove can move 4k bytes of data when source and destination are not overlapped
TestAllocBuffer(0, 4096 bytes, COOKIE)
TestAllocBuffer(1, 4096 bytes, NULL)
Test_API_DRMCRT_memmove(1, 0, 4096)
TestCompBuffer(0, 1, 4096)

9379:DRMCRT_wcsntol returns 0 for a non-digit string
Test_API_DRMCRT_wcsntol(abc, 0)

9380:DRMCRT_wcsntol converts negative numbers
Test_API_DRMCRT_wcsntol(-123, -123)

9381:DRMCRT_wcsntol converts positive numbers
Test_API_DRMCRT_wcsntol(+123, 123)

9395:DRMCRT_wcsncmp correctly compares two strings
TestAllocBuffer(0, 2 wchars, aa, Wide)
TestAllocBuffer(1, 2 wchars, bb, Wide)
Test_API_DRMCRT_wcsncmp(0, 1, 2, Negative)
Test_API_DRMCRT_wcsncmp(1, 0, 2, Positive)
Test_API_DRMCRT_wcsncmp(0, 0, 2, Zero)

9400:DRMCRT_wcslen returns 8 for an 8-wchar string
TestAllocBuffer(0, 9 wchars, 12345678, Wide)
Test_API_DRMCRT_wcslen(0, 8)


9403:DRMCRT_wcsncpy copies the whole source string and zeros out the rest when the destination length is longer than the source length
TestAllocBuffer(0, 4 wchars, abc, Wide)
TestAllocBuffer(1, 5 wchars, xxxxx, Wide)
Test_API_DRMCRT_wcsncpy(1, 0, 5)
TestVerifyBuffer(1, 3 wchars, abc, Wide)
TestAllocBuffer(2, 5 wchars, NULL, Wide)
Test_API_DRMCRT_wcsncpy(2, 0, 3)
TestCompBuffer(1, 2, 10 bytes)

9404:DRMCRT_strncmp correctly compares two strings
TestAllocBuffer(0, 2 chars, aa)
TestAllocBuffer(1, 2 chars, bb)
Test_API_DRMCRT_strncmp(0, 1, 2, Negative)
Test_API_DRMCRT_strncmp(1, 0, 2, Positive)
Test_API_DRMCRT_strncmp(0, 0, 2, Zero)

9407:DRMCRT_abs returns the absolute value of the given number
Test_API_DRMCRT_abs(1, 1)
Test_API_DRMCRT_abs(-100, 100)
Test_API_DRMCRT_abs(0, 0)


9409:DRMCRT_Base64Encode can encode random data
TestAllocBuffer(0, 100 bytes, RANDOM)
TestAllocBuffer(1, 200 bytes, NULL, Wide)
TestAllocBuffer(2, 100 bytes, NULL)
Test_API_DRM_Base64Encode(ANSI, 0, 100, 1, 200, NULL)
Test_API_DRM_Base64Decode(ANSI, 1, 100 bytes, 2, 0, 100)
TestCompBuffer(0, 2, 100 bytes)
Test_API_DRM_Base64Encode(WIDE, 0, 100, 1, 200, NULL)
Test_API_DRM_Base64Decode(WIDE, 1, 100 bytes, 2, 0, 100)
TestCompBuffer(0, 2, 100 bytes)

9416:DRMCRT_Base64Decode can decode the string encoded by DRM_Base64Encode and standard base64 encoding
TestAllocBuffer(0, 57 bytes, 7BZ*gTLq*LKyT3GcIWH8d5JkWiklMf7Aod!lhBgJpcTRu!chtojzMg==)
TestAllocBuffer(1, 57 bytes, 7BZ/gTLq/LKyT3GcIWH8d5JkWiklMf7Aod+lhBgJpcTRu+chtojzMg==)
TestAllocBuffer(2, 80 bytes, NULL)
Test_API_DRM_Base64Decode(ANSI, 0, 40 bytes, 2, 0, 40)
Test_API_DRM_Base64Decode(ANSI, 1, 40 bytes, 0, 0, 40)
TestCompBuffer(0, 2, 40 bytes)

TestAllocBuffer(0, 57 bytes, 7BZ*gTLq*LKyT3GcIWH8d5JkWiklMf7Aod!lhBgJpcTRu!chtojzMg==, Wide)
TestAllocBuffer(1, 57 bytes, 7BZ/gTLq/LKyT3GcIWH8d5JkWiklMf7Aod+lhBgJpcTRu+chtojzMg==, Wide)
TestAllocBuffer(2, 80 bytes, NULL, Wide)
Test_API_DRM_Base64Decode(WIDE, 0, 40 bytes, 2, 0, 40)
Test_API_DRM_Base64Decode(WIDE, 1, 40 bytes, 0, 0, 40)
TestCompBuffer(0, 2, 40 bytes)

-------------------BVT ends here--------------------------
 
9376:DRMCRT_memmove can move one byte of data
TestAllocBuffer(0, 1 byte, COOKIE)
TestAllocBuffer(1, 1 byte, NULL)
Test_API_DRMCRT_memmove(1, 0, 1)
TestCompBuffer(0, 1, 1)

9378:DRMCRT_memmove can move 4 bytes of data when source and destination are overlapped
TestAllocBuffer(0, 5 bytes, 12345)
TestSetBuffer(1, 0, 1 byte offset)
Test_API_DRMCRT_memmove(0, 1, 4)
TestVerifyBuffer(0, 5 bytes, 23455)
Test_API_DRMCRT_memmove(1, 0, 4)
TestVerifyBuffer(0, 5 bytes, 22345)

9384:DRMCRT_wcsntol works on digital strings with non-digital characters at the end
Test_API_DRMCRT_wcsntol(123xyz, 123)

9396:DRMCRT_wcsncmp does not go over the given length
TestAllocBuffer(0, 4 wchars, aabb, Wide)
TestAllocBuffer(1, 2 wchars, aa, Wide)
Test_API_DRMCRT_wcsncmp(0, 1, 2, Zero)
Test_API_DRMCRT_wcsncmp(1, 0, 2, Zero)

9397:DRMCRT_wcsncmp returns zero when first and last are empty strings
TestAllocBuffer(0, 1 wchars, EMPTY, Wide)
TestAllocBuffer(1, 1 wchars, EMPTY, Wide)
Test_API_DRMCRT_wcsncmp(0, 1, 0, Zero)

9398:DRMCRT_wcslen returns 0 for an empty string
TestAllocBuffer(0, 1 wchars, EMPTY, Wide)
Test_API_DRMCRT_wcslen(0, 0)

9399:DRMCRT_wcslen returns 1 for a 1-wchar string
TestAllocBuffer(0, 2 wchars, a, Wide)
Test_API_DRMCRT_wcslen(0, 1)

9401:DRMCRT_wcsncpy copies the content from source to destination when the destination size is the same as the source length
TestAllocBuffer(0, 8192 wchars, COOKIE, Wide)
TestAllocBuffer(1, 8192 wchars, NULL, Wide)
Test_API_DRMCRT_wcsncpy(1, 0, 8192)
TestCompBuffer(0, 1, 8192)

9402:DRMCRT_wcsncpy only copies the given length of the source to destination
TestAllocBuffer(0, 6 wchars, abcdef, Wide)
TestAllocBuffer(1, 6 wchars, NULL, Wide)
Test_API_DRMCRT_wcsncpy(1, 0, 3)
TestVerifyBuffer(1, 3 wchars, abc, Wide)
TestVerifyBuffer(1, 4 wchars, abcd, Wide)=1(DRM_S_FALSE)

9405:DRMCRT_strncmp does not go over the given length
TestAllocBuffer(0, 4 chars, aabb)
TestAllocBuffer(1, 2 chars, aa)
Test_API_DRMCRT_strncmp(0, 1, 2, Zero)
Test_API_DRMCRT_strncmp(1, 0, 2, Zero)

9406:DRMCRT_strncmp returns zero when first and last are empty strings
TestAllocBuffer(0, 1 chars, EMPTY)
TestAllocBuffer(1, 1 chars, EMPTY)
Test_API_DRMCRT_strncmp(0, 1, 0, Zero)

9408:DRMCRT_isxxx returns the same result as the standard CRT version for all valid wide characters
Test_API_DRMCRT_isxxx(0, 127)

9410:DRMCRT_Base64Encode checks null parameters
TestAllocBuffer(0, 400 bytes, NULL)
TestAllocBuffer(1, 100 bytes, RANDOM)
Test_API_DRM_Base64Encode(ANSI, NULL, 100, 0, 200, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Encode(WIDE, NULL, 100, 0, 200, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Encode(ANSI, 1, 0, 0, 200, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Encode(WIDE, 1, 0, 0, 200, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Encode(ANSI, 1, 100, 0, NULL, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Encode(WIDE, 1, 100, 0, NULL, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)

9411:DRMCRT_Base64Decode checks invalid parameters
TestAllocBuffer(0, 200 bytes, NULL)
TestAllocBuffer(1, 100 bytes, RANDOM)
Test_API_DRM_Base64Decode(ANSI, NULL, 100 bytes, 1, 0, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Decode(WIDE, NULL, 100 bytes, 1, 0, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Decode(ANSI, 0, NULL, 1, 0, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)
Test_API_DRM_Base64Decode(WIDE, 0, NULL, 1, 0, NULL)=-2147024809(0X80070057,DRM_E_INVALIDARG)

9412:DRMCRT_Base64Decode returns the required buffer length when output data pointer is null
TestAllocBuffer(0, 57 bytes, 7BZ*gTLq*LKyT3GcIWH8d5JkWiklMf7Aod!lhBgJpcTRu!chtojzMg==)
Test_API_DRM_Base64Decode(ANSI, 0, 0 bytes, NULL, 0, 40)=-2147024774(0X8007007A, DRM_E_BUFFERTOOSMALL)
TestAllocBuffer(0, 57 bytes, 7BZ*gTLq*LKyT3GcIWH8d5JkWiklMf7Aod!lhBgJpcTRu!chtojzMg==, Wide)
Test_API_DRM_Base64Decode(WIDE, 0, 0 bytes, NULL, 0, 40)=-2147024774(0X8007007A, DRM_E_BUFFERTOOSMALL)

9413:DRM_Base64Encode returns the required encode buffer length when all output parameters are null
TestAllocBuffer(0, 300 bytes, COOKIE)
Test_API_DRM_Base64Encode(ANSI, 0, 300, NULL, 0, 400)=-2147024774(0X8007007A, DRM_E_BUFFERTOOSMALL)
TestAllocBuffer(0, 300 bytes, COOKIE, Wide)
Test_API_DRM_Base64Encode(WIDE, 0, 300, NULL, 0, 400)=-2147024774(0X8007007A, DRM_E_BUFFERTOOSMALL)

9414:DRM_Base64Encode returns the required encode buffer length when the given length is not large enough
TestAllocBuffer(0, 300 bytes, COOKIE)
TestAllocBuffer(1, 200 bytes, COOKIE)
Test_API_DRM_Base64Encode(ANSI, 0, 300, 1, 200, 400)=-2147024774(0X8007007A, DRM_E_BUFFERTOOSMALL)
TestAllocBuffer(0, 300 bytes, COOKIE, Wide)
TestAllocBuffer(1, 200 bytes, COOKIE, Wide)
Test_API_DRM_Base64Encode(WIDE, 0, 300, 1, 200, 400)=-2147024774(0X8007007A, DRM_E_BUFFERTOOSMALL)

9415:DRM_Base64Encode can encode 1, 2, 3 bytes of data
TestAllocBuffer(0, 3 bytes, abc)
TestAllocBuffer(1, 10 wchars, NULL, Wide)

' encode then decode for 3-byte blob
TestAllocBuffer(2, 3 bytes, NULL)
Test_API_DRM_Base64Encode(ANSI, 0, 3, 1, 10, NULL)
Test_API_DRM_Base64Decode(ANSI, 1, 3 bytes, 2, 0, 3)
TestCompBuffer(0, 2, 3 bytes)
Test_API_DRM_Base64Encode(WIDE, 0, 3, 1, 10, NULL)
Test_API_DRM_Base64Decode(WIDE, 1, 3 bytes, 2, 0, 3)
TestCompBuffer(0, 2, 3 bytes)

' encode then decode for 2-byte blob
TestAllocBuffer(2, 3 bytes, NULL)
Test_API_DRM_Base64Encode(ANSI, 0, 2, 1, 10, NULL)
Test_API_DRM_Base64Decode(ANSI, 1, 3 bytes, 2, 0, 2)
TestCompBuffer(0, 2, 2 bytes)
TestCompBuffer(0, 2, 3 bytes)=1(DRM_S_FALSE)
Test_API_DRM_Base64Encode(WIDE, 0, 2, 1, 10, NULL)
Test_API_DRM_Base64Decode(WIDE, 1, 3 bytes, 2, 0, 2)
TestCompBuffer(0, 2, 2 bytes)
TestCompBuffer(0, 2, 3 bytes)=1(DRM_S_FALSE)

' encode then decode for 1-byte blob
TestAllocBuffer(2, 3 bytes, NULL)
Test_API_DRM_Base64Encode(ANSI, 0, 1, 1, 10, NULL)
Test_API_DRM_Base64Decode(ANSI, 1, 3 bytes, 2, 0, 1)
TestCompBuffer(0, 2, 1 bytes)
TestCompBuffer(0, 2, 2 bytes)=1(DRM_S_FALSE)
Test_API_DRM_Base64Encode(WIDE, 0, 1, 1, 10, NULL)
Test_API_DRM_Base64Decode(WIDE, 1, 3 bytes, 2, 0, 1)
TestCompBuffer(0, 2, 1 bytes)
TestCompBuffer(0, 2, 2 bytes)=1(DRM_S_FALSE)

' bug 144901 postponed
'9417:DRM_UTL_DecodeKID should decode short KIDs
'TestAllocBuffer(0, 16 bytes, NULL)
'TestAllocBuffer(1, 16 bytes, NULL)
'Test_API_DecodeKID(short1, 0)
'Test_API_DecodeKID(short2, 1)
'TestCompBuffer(0, 1, 16 bytes)=1(DRM_S_FALSE)

11823:DRM_UTL_DecodeKID should decode normal KIDs
TestAllocBuffer(0, 16 bytes, NULL)
TestAllocBuffer(1, 16 bytes, NULL)
Test_API_DecodeKID(lbmCh6haEE+5Z86EDmEudA==, 0)
Test_API_DecodeKID(lamCh6haEE+5Z86EDmEudA==, 1)
TestCompBuffer(0, 1, 16 bytes)=1(DRM_S_FALSE)

'DecodeKID only takes the first 16 bytes
11824:DRM_UTL_DecodeKID should decode long KIDs
TestAllocBuffer(0, 16 bytes, NULL)
TestAllocBuffer(1, 16 bytes, NULL)
Test_API_DecodeKID(lbmCh6haEE+5Z86EDmEudAACCC==, 0)
Test_API_DecodeKID(lamCh6haEE+5Z86EDmEudAACCC==, 1)
TestCompBuffer(0, 1, 16 bytes)=1(DRM_S_FALSE)
